package com.yueya.system.controller;

import com.yueya.common.base.BaseController;
import com.yueya.common.web.RestResult;
import com.yueya.system.dao.tables.pojos.SysUserDO;
import com.yueya.system.service.SysUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("${auth.adminPath}/api")
public class ApiController extends BaseController {
    @Autowired
    private SysUserService userService;

    @RequestMapping("userlist")
    public RestResult userList(String phone,String loginName) {
        SysUserDO userDO = new SysUserDO();
        userDO.setPhone(phone);
        userDO.setLoginName(loginName);
        if(StringUtils.isAllBlank(phone,loginName)) {
            return RestResult.FAILER("参数为空");
        }
        return RestResult.OkWithData(userService.findUser(userDO));
    }
}
